package com.wds.service.impl;

import com.wds.common.utils.SecurityUtils;
import com.wds.domain.entity.LoginUser;
import com.wds.domain.entity.User;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Service;

/**
 * @author WDs , wds8.24@outlook.com
 * @version 1.0
 * @since 2023-01-02 11:07
 */
@Service("ps")
public class PermissionServiceImpl {
    public boolean hasPermission(String permission){
        LoginUser loginuser = SecurityUtils.getCurrentLoginUser();
        if (loginuser == null) {
            return false;
        }
        return loginuser.getPermissions().contains(permission);
    }
}
